package com.ict.web.dto;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ict.common.utils.bean.BeanUtils;
import com.ict.web.domain.ProfessionalQualification;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;
import java.util.Date;

@Data
public class UpdateProfessionalQualificationDto {


  @ApiModelProperty(value = "职业资格id")
  @JsonFormat(shape = JsonFormat.Shape.STRING)
  @TableId(value = "professional_id",type = IdType.ASSIGN_ID)
  private Long professionalId;

  @ApiModelProperty(value = "资格名称")
  private String qualificationName;

  @ApiModelProperty(value = "资格证书号")
  private String qcNo;

  @ApiModelProperty(value = "注册单位")
  private String registeredUnit;

  @DateTimeFormat(pattern = "yyyy-MM-dd")
  @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8",shape = JsonFormat.Shape.STRING)
  @ApiModelProperty(value = "注册时间")
  private Date registrationTime;

  @DateTimeFormat(pattern = "yyyy-MM-dd")
  @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8",shape = JsonFormat.Shape.STRING)
  @ApiModelProperty(value = "过期时间")
  private Date expirationTime;

  @ApiModelProperty(value = "附件")
  private String qualificationFile;

  public static ProfessionalQualification of(UpdateProfessionalQualificationDto updateDto){
    ProfessionalQualification bean = new ProfessionalQualification();
    BeanUtils.copyProperties(updateDto,bean);

    bean.setUpdateTime(LocalDateTime.now());

    return bean;
  }
}
